export interface ProductCategory {
  categoryDescription: string;
  createdOn: string;
  isActive: boolean;
  productCategoryId: string;
  productCategoryName: string;
  remark: string;
  updatedOn: string;
}
export type ParProductCategory = Partial<ProductCategory>;

export interface ProductTypesItem {
  children: ProductTypesItem[];
  createdOn: string;
  isEnable: boolean;
  parentTypeId: string;
  productTypeCode: string;
  productTypeId: string;
  productTypeName: string;
  productTypePhoto: string;
  updatedOn: string;
  isLeaf: boolean;
  remark: string;
  disabled?: boolean;
}

export type ParProductTypesItem = Partial<ProductTypesItem>;

export interface ManufacturerItem {
  isEnable: boolean;
  manufacturerDescriptions: string;
  manufacturerFullName: string;
  manufacturerId: string;
  manufacturerLogo: string;
  manufacturerShortName: string;
  manufacturerUrl: string;
  servicePhoneNumber: string;
  remark: string;
}
export type ParManufacturerItem = Partial<ManufacturerItem>;

export interface ProductBrandItem {
  brandDescriptions: string;
  brandId: string;
  brandLogo: string;
  brandName: string;
  brandUrl: string;
  manufacturerId: string;
  tenantId: string;
  isEnable: boolean;
}
export type ParProductBrandItem = Partial<ProductBrandItem>;

export interface ProductItem {
  additionalinfo: AttrInfo[];
  brandId: string;
  manufacturerId: string;
  productCategoryId: string;
  productCode: string;
  imei: string;
  slaveId: number;
  productId: string;
  productIdentifier: string;
  productName: string;
  productPhotos: string[];
  productSerialNumber: string;
  productSpecificationId: string;
  productTypeId: string;
  productWarrantyBegin: string;
  productWarrantyEnd: string;
  remark: string;
  productDescriptions: string;
  productWarrantyDate: string[];
  isConnected: boolean;
  productTypeName: string;
  specificationModelName: string;
  productCategoryName: string;
  manufacturerShortName: string;
  brandName: string;
  isUnderWarranty: number;
}
export type ParProductItem = Partial<ProductItem>;

export interface ListItem {
  id: string;
  name: string;
}

export interface ProductModelItem {
  brandId: string;
  manufacturerId: string;
  parentSpecificationId: string;
  specificationCode: string;
  specificationId: string;
  specificationModelName: string;
  specificationType: string;
}
export type ParProductModelItem = Partial<ProductModelItem>;

export interface ProductModelSearch {
  brandId?: string;
  manufacturerId?: string;
  searchText?: string;
}

export interface ProductModelList {
  brandId: string;
  brandName: string;
  children?: ProductModelList[];
  createdOn: string;
  manufacturerId: string;
  manufacturerShortName: string;
  parentSpecificationId: string;
  specificationCode: string;
  specificationId: string;
  specificationModelName: string;
  specificationType: string;
  updatedOn: string;
}

export type ParProductModelList = Partial<ProductModelList>;

export interface ProductModelOptions {
  parentSpecificationId?: string;
  specificationType?: string;
  manufacturerId?: string;
  brandId?: string;
}

export interface ProductFaultItem {
  createdOn: string;
  productFaultCause: string;
  productFaultCode: string;
  productFaultDescription: string;
  productFaultId: string;
  productFaultLevel: string;
  productFaultName: string;
  productFaultResolution: string;
  productFaultType: string;
  productId: string;
  productSpecificationId: string;
  productTypeId: string;
  updatedOn: string;
}
export type ParProductFaultItem = Partial<ProductFaultItem>;

export interface ProductArchivesItem {
  archiveLocation: string;
  archiveName: string;
  archiveTag: string;
  createdOn: string;
  productArchiveId: string;
  productId: string;
  updatedOn: string;
}
export type ParProductArchivesItem = Partial<ProductArchivesItem>;

export type AttrInfo = {
  customLabel?: string;
  customValue?: string;
};

export interface ProductOtaPackages {
  createdOn: string;
  otaPackageId: string;
  packageLocation: string;
  packageDescription: string;
  packageName: string;
  packageSize: number;
  packageVersion: string;
  productIds: string | string[];
  updatedOn: string;
  upgradeState: number;
  file: any;
}

export type ParProductOtaPackages = Partial<ProductOtaPackages>;

export interface UpgradeItem {
  createdOn: string;
  otaPackageId: string;
  packageDescription: string;
  packageName: string;
  packageSize: number;
  packageVersion: string;
  productId: string;
  upgradeState: number;
}
export type ParUpgradeItem = Partial<UpgradeItem>;

export interface BitItem {
  attributeDisplayName: string;
  attributeId: string;
  attributeName: string;
  bitMask: number;
  defaultValue: number;
  description: string;
  functionCode: string;
  unit: string;
  productId: string;
  valueStatus: { value: number; valueDescription: string }[];
  // 自定义属性
  value1: string;
  value2: string;
}
export interface ProtocolsItem {
  attributeDisplayName: string;
  attributeId: string;
  attributeName: string;
  attributeTag: string;
  bits: ParBitItem[];
  byteOrder: string;
  createdOn: string;
  defaultValue: number;
  description: string;
  displayOrder: number;
  functionCode: string;
  indexOrder: number;
  productId: string;
  productProtocolId: string;
  protocolIdentifier: string;
  readWriteType: string;
  registerAddress: number;
  registerCount: number;
  registerType: string;
  unit: string;
  unitId: number;
  updatedOn: string;
  valueDataType: string;
  valueOffset: number;
  valueRange: {
    max: number;
    min: number;
  };
  valueRatio: number;
  valueStatus: {
    value: number;
    valueDescription: string;
  }[];
  value1: string;
  value2: string;
  max: number;
  min: number;
}
export type ParProtocolsItem = Partial<ProtocolsItem>;
export type ParBitItem = Partial<BitItem>;
export enum RegisterType {
  // ALL = "ALL",
  COIL_STATUS = "COIL_STATUS",
  INPUT_STATUS = "INPUT_STATUS",
  HOLDING_REGISTER = "HOLDING_REGISTER",
  INPUT_REGISTER = "INPUT_REGISTER",
}

export enum ByteOrder {
  ABCD = "ABCD",
  DCBA = "DCBA",
  BADC = "BADC",
  CDAB = "CDAB",
}
export enum ReadWriteType {
  R = "R",
  RW = "RW",
}
export enum ValueDataType {
  string = "string",
  bool = "bool",
  bytes = "bytes",
  bit = "bit",
  bits = "bits",
  int8 = "int8",
  uint8 = "uint8",
  int16 = "int16",
  uint16 = "uint16",
  float16 = "float16",
  int32 = "int32",
  uint32 = "uint32",
  float32 = "float32",
  int64 = "int64",
  uint64 = "uint64",
  float64 = "float64",
}

export enum FunctionCode {
  "01" = "01",
  "02" = "02",
  "03" = "03",
  "04" = "04",
  "05" = "05",
  "06" = "06",
  "0F" = "0F",
  " 10" = "10",
}
